package org.springframework.learn.beans.service;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.PayloadApplicationEvent;
import org.springframework.stereotype.Component;

/**
 * Description
 * Copyright © 启明星辰 版权所有
 *
 * @author chenjiquan
 * @date 2024-07-10
 */
@Component
public class ZhouyuApplicationListener implements ApplicationListener<ApplicationEvent> {
	@Override
	public void onApplicationEvent(ApplicationEvent event) {
		if (event instanceof PayloadApplicationEvent){
			System.out.println(((PayloadApplicationEvent) event).getPayload());
		}
//		PayloadApplicationEvent applicationEvent = (PayloadApplicationEvent) event;
		System.out.println(event.getSource());
//		System.out.println(applicationEvent.getPayload());
	}
}
